Auto merge of #1908 - alexcrichton:moar-stack, r=huonw
authorbors <bors@rust-lang.org>
Mon, 17 Aug 2015 16:22:35 +0000 (16:22 +0000)
committerbors <bors@rust-lang.org>
Mon, 17 Aug 2015 16:22:35 +0000 (16:22 +0000)
commitd48f89d4293dbcdc1a3bdfc376e3b6dea1236cfa
treee00299f3d06fc506646a4117689e143afa853737
parentdd3f0a780ebead66320edfa232703ef985e487f1
parent01397071d46ce6d3f736a4fc05d286d8030a7be4
Auto merge of #1908 - alexcrichton:moar-stack, r=huonw

There have been a number of reports of Cargo triggering a stack overflow in the
algorithm implemented in `cargo::core::resolve`, and although many attempts have
been made to reduce the stack space of the two relevant recursive functions it
seems likely that this will not always be enough. For now, before moving the
recursion to the heap manually, spawn the main thread with a large stack (e.g.
mirror what the compiler does) to ensure that the same scenarios happen across
platforms at least.

Currently on my machine I get a 2MB stack on Linux and a 512K stack on OSX, so
bumping this up to 8MB should be more than enough for the recursion in this
algorithm. I also hope that with nonzeroing drop a few of the recursive calls
will be able to become tail recursive, which should also help with stack space!

Closes #1897